﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenExpressApp.MetaAttribute;
using Csla.Wpf;
using OpenExpressApp.Command;
using Csla.Core;
using System.ComponentModel;
using System.Windows;
using OpenExpressApp.Template;
using OpenExpressApp.Types;
using Csla;
using OpenExpressApp.WPF.Controls;
using System.Collections.ObjectModel;
using log4net;
using System.Collections;
using OpenExpressApp.MetaModel;
using Avalon.Windows.Controls;
using OpenExpressApp.WPF.Templete;
using OpenExpressApp.Module;
using OpenExpressApp.Module.WPF;
using System.Windows.Controls;
using Ricciolo.Controls;
using System.Reflection;
using System.Windows.Markup;
using System.Diagnostics;
using AvalonDock;
using OpenExpressApp.Module.WPF.Editors;
using Csla.OpenExpressApp;

namespace OpenExpressApp.WPF.Command
{
    [Command(CommandNames.ClearQueryCondition, Label = "清除条件", ToolbarType = ToolbarType.Manual, ToolTip = "清除条件")]
    public class ClearQueryConditionCommand : WPFViewCommand
    {
        public override void Execute(ObjectView view)
        {
            BusinessBase currentObject = view.CurrentObject as BusinessBase;
            if (currentObject == null) throw new ArgumentNullException("currentObject");
            (view as QueryObjectView).AttachNewQueryObject();
            foreach (var item in view.PropertyEditors)
            {
                item.PropertyValue = null;
            }
        }
    }
}